/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sdc.net.server.comp;

/*import java.util.LinkedList;
import java.util.List;
import sdc.utility.MersenneTwisterFactory;
import sdc.utility.WeightedLot;
import sdc.component.type.ComponentType;*/

/**
 *
 * @author yokoe
 */
public class WorkQueue {

	/**
	 * work queue
	 */
	/*private List<ComponentType> workQueue;


	public WorkQueue()
	{
		this.workQueue = new LinkedList<ComponentType>();
	}


	public void arrival(ComponentType componentType)
	{
		workQueue.add(componentType);
	}


	public ComponentType departure(double nodeCapability)
	{
		if(workQueue.size() == 0) return null;

		WeightedLot<ComponentType> lot = new WeightedLot<ComponentType>(MersenneTwisterFactory.getMersenneTwister());

		for(ComponentType componentType : workQueue)
		{
			lot.add(componentType, componentType.getWorkload());
		}

		ComponentType removed = lot.pickup();

		workQueue.remove(removed);

		return removed;
	}


	public int getUserNum(ComponentType componentType)
	{
		int userNum = 0;

		for(ComponentType type : workQueue)
		{
			if(type.equals(componentType)) userNum++;
		}

		return userNum;
	}


	public int getQueueLength()
	{
		return this.workQueue.size();
	}*/
}
